package com.song.sort;

import java.util.*;

public class ListSortTest {
    public static void main(String[] args){

        List<String> list = new ArrayList<>();

        list.add("sbd");
        list.add("cnd");
        list.add("a");
        list.add("s");

        Collections.sort(list, (o1,o2)->o1.compareTo(o2));    //Collections.sort 底层是利用数组的归并排序，o1.compareTo(02) 是升序 反之降序
        for (String s : list){
            System.out.println(s);
        }

    }
}
